FROM bishengjdk-17:latest

ARG MAVEN_VERSION=3.9.10

COPY settings.xml .

RUN set -eux; \
    mkdir /opt/maven && \
    curl -o maven.tar.gz https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz && \
    tar -zxf maven.tar.gz -C /opt/maven --strip-components=1 && \
    mkdir /root/.m2 && mv settings.xml /root/.m2/settings.xml && \
    rm -rf maven.tar.gz

RUN set -eux; \
    mkdir -p /root/ProjectRoot

VOLUME ["/root/ProjectRoot"]

ENV PATH /opt/maven/bin:$PATH

CMD ["mvn", "-v"]
